package xijia.plus.docs.thymeleafuser.util;

import cn.hutool.core.io.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.ResourceLoader;

import java.io.File;
import java.io.IOException;

public class ResourceCopyUtil {



    public static void copyResources(String sourceFolder, String destinationFolder) {
        ClassPathResource resource = new ClassPathResource(sourceFolder);
        File source = null;
        try {
            source = resource.getFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        File destination = new File(destinationFolder);
        if (!destination.exists()) {
            destination.mkdirs();
        }
        FileUtil.copy(source, destination, true);
    }
}
